<template>
  <div class='container'>
    <el-dialog
      title="题目预览"
      :visible="AuditdialogVisible"
      width="25%"
      @close="close">
      <el-radio v-model="chkState" :label=1>通过</el-radio>
      <el-radio v-model="chkState" :label=2>拒绝</el-radio>
      <el-input
      style="margin-top: 20px;"
        type="textarea"
        :rows="3"
        placeholder="请输入审核意见"
        v-model="chkRemarks">
      </el-input>
        <span slot="footer" class="dialog-footer">
          <el-button @click="close">取 消</el-button>
          <el-button type="primary" @click="isEditChk">确 定</el-button>
        </span>
    </el-dialog>
  </div>
</template>

<script>
import { choiceCheck } from '../../api/hmmm/questions'
export default {
  props: {
    AuditdialogVisible: {
      type: Boolean
    },
    id: {
      type: Number,
      default: null
    }
  },
  data () {
    return {
      chkState: 1,
      chkRemarks: ''
    }
  },
  created () {
    console.log(this.id)
  },
  methods: {
    close () {
      this.$emit('update:AuditdialogVisible', false)
    },
    handleClose () {

    },
    async isEditChk () {
      const data = { id: this.id, chkState: this.chkState, chkRemarks: this.chkRemarks }
      console.log(data)
      if (data.chkRemarks === '') {
        return this.$message({
          showClose: true,
          message: '请输入审核意见',
          type: 'warning'
        })
      }
      await choiceCheck(data)
      this.$message({
        showClose: true,
        message: '审核成功',
        type: 'success'
      })
      this.$emit('CheckOk')
      this.close()
    }

  }
}
</script>

<style scoped lang='scss'>

</style>
